package com.itheima.controller.ordersetting;

import com.itheima.api.ordersetting.OmsOrderSettingService;
import com.itheima.vo.domain.AjaxResult;
import com.itheima.vo.pojo.OmsOrderSetting;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/orderSetting")
@Slf4j
public class OmsOrderSettingController {

    @DubboReference
    private OmsOrderSettingService settingService;

    /**
     * 修改指定订单设置
     * @param id
     * @return
     */
    @PostMapping("/update/{id}")
    public AjaxResult update(@PathVariable Integer id, @RequestBody OmsOrderSetting setting){
        settingService.updateSetting(id,setting);
        return AjaxResult.success();
    }

    /**
     * 获取指定订单设置
     * @param id
     * @return
     */
    @GetMapping("/{id}")
    public AjaxResult getOne(@PathVariable Integer id){
        OmsOrderSetting setting = settingService.getById(id);
        return AjaxResult.success(setting);
    }


}
